import { IEquatable } from './Utils/IEquatable';

export class InplaceArray<T> extends Array<T> implements IEquatable<InplaceArray<T>> {
	private static readonly MaxLength = 4;

	constructor(elem0: T, elem1?: T, elem2?: T, elem3?: T) {
		super();

		super.push(elem0);

		if (elem1) {
			super.push(elem1);
		}
		if (elem2) {
			super.push(elem2);
		}
		if (elem3) {
			super.push(elem3);
		}
	}

	[n: number]: T;
	

	equals(other: InplaceArray<T>): boolean {
		return this[0] === other[0] && this[1] === other[1] && this[2] === other[2] && this[3] === other[3];
	}
}
